package com.broada.apm.utils;

import java.util.Collection;
import java.util.Map;

public class AbstractItemManager<K,T> {
	protected Map<K, T> items ;
	protected AbstractItemManager(String name) {
		items = CachedItemManager.getInstance().getManager(name);
	}
	
	public T get(K key){
		T l4resource = items.get(key);
		return l4resource;
	}
	
	protected T put(K key, T v){
		T l4resource = items.put(key, v);
		return l4resource;
	}
	
	protected void putAll(Map<K,T> map){
		items.putAll(map);
	}
	
	public int getItemsCount() {
		return items.size();
	}
	
	public Collection<T> getItems(){
		return items.values();
	}
	public void clear() {
		items.clear();
	}
	public boolean contains(K k) {
		return items.containsKey(k);
	}
	
	public void remove(K k) {
		items.remove(k);
	}
}
